<include file="Public/header.html" />
<link href="__PUBLIC__/css/tool/time.css" rel="stylesheet">

<div class="mainContent">
    <div class="">
        <div class="group-component">
            <label class="col-blue02 YaHei fz14">Unix时间戳:</label>
            <input id="txt-unix-time" type="text" class="InputTxt w140">

            <input type="button" value="转换成北京时间" id="unixtoutc8"
                   tabindex="2" class="InputBtnC col-blue02 plr10 mr20">
            <input id="txt-bj-time" type="text" class="InputTxt w140">
        </div>
        <div class="group-component">
            <label class="col-blue02 YaHei fz14">北京时间（年/月/日 时:分:秒）:</label>
            <input type="text" id="txt-time-bj" class="InputTxt w140">

            <input type="button" value="转换成Unix时间戳" id="ctounix"
                   tabindex="2" class="InputBtnC col-blue02 plr10 mr20">
            <input type="text" id="txt-time-unix" class="InputTxt w140">
        </div>
    </div>
</div>



<include file="Public/footer.html" />

<script type="text/javascript" src='__PUBLIC__/js/jquery-3.3.1.min.js'></script>
<script type="text/javascript">
    $('#unixtoutc8').on('click',function(){
        var unix_time = $('#txt-unix-time').val();
        $.ajax({
            url:"{:U('Home/Tool/unixToBj')}",
            type:'post',
            data:{
                unix_time:unix_time
            },
            success:function(data){
                $('#txt-bj-time').val(data.time);
            }
        })
    })

    $('#ctounix').on('click',function(){
        var bj_time = $('#txt-time-bj').val();
        $.ajax({
            url:"{:U('Home/Tool/bjToUnix')}",
            type:'post',
            data:{
                bj_time:bj_time
            },
            success:function(data){
                $('#txt-time-unix').val(data.time);
            }
        })
    })

</script>
